# Fish Data Models 

#DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, "sqlite3://#{Dir.pwd}/fishtank.sqlite3")

class Fish
  include DataMapper::Resource
  property :uuid, Text, :required => true, :key => true
  property :uri,  Text, :required => true, :unique => true
  property :os,   Text
  property :fishbrain_md5,    Text
  property :fishtank_md5, Text
  property :fish_md5,     Text
  property :created_at, Time
  property :updated_at, Time

  has n, :fishFriends
end

class FishFriend
  include DataMapper::Resource
  property :uuid, Text, :required => true, :key => true
  property :uri,  Text, :required => true, :unique => true
  property :os,   Text
  property :created_at, Time
  property :updated_at, Time

  belongs_to :fish
end

DataMapper.finalize
Fish.auto_migrate!
FishFriend.auto_migrate!
